//
//  LGCancerPatientInspectController.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2024/7/19.
//  癌症 -- 检验检查

#import "LGCancerPatientInspectController.h"
#import "LGCancerInspectTableController.h"
@interface LGCancerPatientInspectController ()<LGBottomButtonDelegate>
/**   */
@property (nonatomic , strong)LGCancerInspectTableController *timeVC;
/**   */
@property (nonatomic , strong)LGCancerInspectTableController *typeVC;
/**   */
@property (nonatomic , strong)NSMutableArray *controllerArray;
/**   */
@property (nonatomic , strong)NSArray *titleArray;

@end

@implementation LGCancerPatientInspectController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"检验检查";
    self.view.backgroundColor = [UIColor colorWithString:@"#F3F7F8"];
    UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, Screen_W, viewPix(300))];
    topView.backgroundColor = kNavBgColor;
    [self.view addSubview:topView];
    self.titleArray = @[@"按时间",@"按类型"];
    [self addChildViewController:self.timeVC];
    [self addChildViewController:self.typeVC];
    [self.controllerArray addObject:self.timeVC];
    [self.controllerArray addObject:self.typeVC];
    self.scrollView.backgroundColor = [UIColor clearColor];
    self.titleColorNormal = [UIColor colorWithString:@"#606266"];
    self.titleColorSelected = [UIColor colorWithString:kThemeColor];
    self.progressColor = [UIColor colorWithString:kThemeColor];
    self.menuView.backgroundColor = [UIColor clearColor];
    self.menuViewStyle=WMMenuViewStyleLine;
    self.titleFontName = @"STHeitiTC-Medium";
    self.titleSizeSelected = 16;
    self.titleSizeNormal = 14;
    self.progressWidth = viewPix(13);
    self.progressHeight = 3;
    self.progressViewBottomSpace = 0;
    self.progressViewCornerRadius = 2;
    self.selectIndex = 0;
    [self reloadData];
    self.scrollView.backgroundColor = [UIColor clearColor];
}

#pragma mark
#pragma mark ====> WMPageControllerDelegate
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    return self.titleArray.count;
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    return self.titleArray[index];
}

- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    return self.controllerArray[index];
}

- (CGFloat)menuView:(WMMenuView *)menu widthForItemAtIndex:(NSInteger)index {
    return Screen_W/2.0;
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForMenuView:(WMMenuView *)menuView {
    return CGRectMake(0, 0, Screen_W, viewPix(44));
}

- (CGRect)pageController:(WMPageController *)pageController preferredFrameForContentView:(WMScrollView *)contentView {
    return CGRectMake(0, viewPix(44), Screen_W, Screen_H-topBarHeight-viewPix(44));
}

- (void)pageController:(WMPageController *)pageController willEnterViewController:(__kindof UIViewController *)viewController withInfo:(NSDictionary *)info{
    NSInteger index = [info[@"index"] integerValue];
//    self.addButton.hidden = (index<2)?NO:YES;
//    LGBaseViewController *controller = (LGBaseViewController *)viewController;
//    [controller requestData];
//    NSLog(@">>>>>willEnterView>>>%@",viewController.title);
}

- (void)pageController:(WMPageController *)pageController didEnterViewController:(__kindof UIViewController *)viewController withInfo:(NSDictionary *)info{
    NSLog(@">>>>>didEnterView>>>%@",viewController.title);
}


-(NSMutableArray *)controllerArray{
    if(!_controllerArray){
        _controllerArray = [NSMutableArray array];
    }
    return _controllerArray;
}

-(LGCancerInspectTableController *)timeVC{
    if(!_timeVC){
        _timeVC = [[LGCancerInspectTableController alloc] init];
        _timeVC.patientid = self.patientid;
        _timeVC.type = @"date";
    }
    return _timeVC;
}

-(LGCancerInspectTableController *)typeVC{
    if(!_typeVC){
        _typeVC = [[LGCancerInspectTableController alloc] init];
        _typeVC.patientid = self.patientid;
        _typeVC.type = @"type";
    }
    return _typeVC;
}


@end
